<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
// API 模板文件，可以复制
namespace api\resource\controller;

use think\Db;
use think\Request;
use think\Validate;
use cmf\controller\RestBaseController;

class Biao9Controller extends RestBaseController
{


    public function one($data)
    {

        //查 这个表的数据
        @$new_data = $data[0]['content'];
        if (empty($new_data)) {
            return '';
        }
//        dump($new_data);
//        exit;
        $check1 = $new_data->check1;
        $check2 = $new_data->check2;
        $check_arr =[];
        $check2_arr =[];
        foreach ($check1 as $k=>$v) {
            if (isset($v)) {
                $check_arr[$k]= 1;
            }
        }
        foreach ($check2 as $k=>$v) {
            if (isset($v)) {
                $check2_arr[$k]= 1;
            }
        }
        @$checked0 = $check_arr[0] ? 'checked':'';
        @$checked1 = $check_arr[1] ? 'checked':'';
        @$checked2 = $check_arr[2] ? 'checked':'';
        @$checked3 = $check_arr[3] ? 'checked':'';
        @$checked4 = $check_arr[4] ? 'checked':'';
        @$checked5 = $check_arr[5] ? 'checked':'';
        @$checked6 = $check_arr[6] ? 'checked':'';
        @$checked7 = $check_arr[7] ? 'checked':'';
        @$checked8 = $check_arr[8] ? 'checked':'';
        @$checked9 = $check_arr[9] ? 'checked':'';
        @$checked10 = $check_arr[10] ? 'checked':'';

        @$check20 = $check2_arr[0] ? 'checked':'';
        @$check21 = $check2_arr[1] ? 'checked':'';
        @$check22 = $check2_arr[2] ? 'checked':'';
        @$check23 = $check2_arr[3] ? 'checked':'';
        @$check24 = $check2_arr[4] ? 'checked':'';
        @$check25 = $check2_arr[5] ? 'checked':'';



        $html = '
       <div style="width: 650px;margin: 0 auto;">
            <div style="font-size: 16px;font-weight: 600;margin-bottom: 15px;">一、项目基本情况表</div>
            <table border="1" cellspacing="0px" cellpadding="5px" width="650">
                <tbody>
                    <tr>
                        <td style="font-weight: 600">*项目名称</td>
                        <td colspan="4">'.@$new_data->text1.'</td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">*项目起止时间</td>
                        <td colspan="4">'.@$new_data->text2.'</td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">*项目总经费预算（万元）</td>
                        <td colspan="2">'.@$new_data->text3.'</td>
                        <td style="font-weight: 600">*申请经费资助（万元）</td>
                        <td>'.@$new_data->text4.'</td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">*课题研究方向</td>
                        <td colspan="4">'.@$new_data->text5.'</td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">*社会经济目标</td>
                        <td colspan="4">'.@$new_data->text6.'</td>
                    </tr>
                    <tr>
                        <td colspan="5" style="font-weight: 600">项目摘要（200字以内）：</td>
                    </tr>
                    <tr>
                        <td colspan="5">'.@$new_data->text7.'</td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">*关键字（用；隔开）：</td>
                        <td colspan="4">'.@$new_data->text8.'</td>
                    </tr>
                    <tr>
                        <td rowspan="3" style="font-weight: 600">项目技术情况</td>
                        <td>*技术领域</td>
                        <td>'.@$new_data->text9.'</td>
                        <td>*学科</td>
                        <td>'.@$new_data->text10.'</td>
                    </tr>
                    <tr>
                        <td>研究活动类型</td>
                        <td>'.@$new_data->text11.'</td>
                        <td>项目研究阶段</td>
                        <td>'.@$new_data->text12.'</td>
                    </tr>
                    <tr>
                        <td>技术来源</td>
                        <td>'.@$new_data->text13.'</td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">预期成果形式</td>
                        <td colspan="4">
                            <label><input type="checkbox" disabled name="check1" '.@$checked0.' value="0">新产品</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked1.'  value="1">新品种</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked2.' value="2">新工艺</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked3.'  value="3">新装置</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked4.' value="4">新材料</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked5.' value="5">技术标准（国际标准、国家标准、行业标准、企业标准）</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked6.'  value="6">专利</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked7.' value="7">计算机软件</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked8.'  value="8">论文论著</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked9.' value="9">研究报告</label>
                            <label><input type="checkbox" disabled name="check1" '.@$checked10.' value="10">其它</label>
                        </td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">项目已受财政资金资助情况</td>
                        <td colspan="4">
                            <label><input type="checkbox" disabled name="check2" '.@$check20.' value="0">国家（部委）财政资金资助</label>
                            <label><input type="checkbox" disabled name="check2" '.@$check21.' value="1">省级财政科技资金资助</label>
                            <label><input type="checkbox" disabled name="check2" '.@$check22.' value="2">省级财政其他部门资金资助</label>
                            <label><input type="checkbox" disabled name="check2" '.@$check23.' value="3">地市财政资金资助</label>
                            <label><input type="checkbox" disabled name="check2" '.@$check24.' value="4">其它</label>
                            <label><input type="checkbox" disabled name="check2" '.@$check25.' value="5">无</label>
                            '.@$new_data->text14.'
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5">其它需要说明的问题:'.@$new_data->text15.'</td>
                    </tr>
                    <tr>
                        <td style="font-weight: 600">*本项目是否涉及实验动物：</td>
                        <td colspan="4" style="font-weight: 600">';

                        if ($new_data->radio1) {
                            $html .= '<label>
                                    <input type="radio"name="radio1" checked="checked" disabled value="1">是
                                    </label>
                                    <label>
                                        <input type="radio" name="radio1"  disabled  value="0">否
                                    </label>';
                        }  else {
                            $html .= '<label>
                                    <input type="radio"name="radio1" disabled value="1">是
                                    </label>
                                    <label>
                                        <input type="radio" name="radio1" disabled  checked="checked" value="0">否
                                    </label>';
                        }

                        $html .='
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        ';

            return $html;

    }



}
